<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>签名</title>
    <link href="../css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="../fonts/iconfont/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../css/global.css"/>
</head>
<body>
	<header class="mui-bar mui-bar-nav bg_white">
	    <button class="mui-btn-link mui-pull-left close_btn"><span class="colorP">取消</span></button>
	    <h1 class="mui-title colorP">签名</h1>
	    <button class="mui-btn-link mui-pull-right"><span class="colorP _confirm" id="save">确定</span></button>
	</header>
	<div class="mui-content">
		<textarea name="" rows="6" cols=""  placeholder="请输入个性签名" id="personalized">&empty;</textarea>
	</div>
</body>
<script src="../js/mui.min.js"></script>
<script src="../js/jquery.min.js"></script>
<script src="../js/apppublic.js"></script>
<script type="text/javascript">
document.addEventListener('plusready', function() {	
	var personalized =plus.storage.getItem('personalized');
	var uid = plus.storage.getItem('uid');
	$('#personalized').val(personalized);
	var ws = plus.webview.currentWebview();
	$('.close_btn').click(function(){
		ws.close();		
	})
	$("#save").on("tap",function(){
		plus.nativeUI.showWaiting('提交中...');  
		personalized=$('#personalized').val();
		console.log(personalized);
		$.ajax({
   			type:"post",
			url:apiRoot,   
			data : {
				action : 'User.update', 
				personalized : personalized,
				uid : uid,
				name:"personalized",
			},
			dataType:'json',
			success:function(data){ 
				console.log(JSON.stringify(data));
				plus.nativeUI.closeWaiting();
				if(data.error == 0){  
					plus.storage.setItem('personalized',data.data.personalized + '');
					personalized=data.data.personalized;
					var parentid = plus.webview.getWebviewById('personal_data.html');console.log(parentid);
					mui.fire(parentid,'personalizedVal',{personalized:personalized});
					
					parentpid = plus.webview.getWebviewById('view/personal_center.html');
						mui.fire(parentpid,'personalizedVal',{personalized:personalized});
					setTimeout(function () {
						ws.close();
					},1000);
					toast('修改成功');
					return; 
				}  
			}, 
			error : function(e){
				console.log(JSON.stringify(e));
				
				errortoast();
			}
		});
	})
	 
})
</script>
</html>